import { createRouter, createWebHistory } from "vue-router";

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: "/",
      redirect: "/login",
    },
    {
      path: "/about",
      name: "about",
      component: () => import("../views/About.vue"),
      // redirect:{name:"首页"},
      children: [
        {
          path: "/home",
          name: "首页",
          component: () => import("../views/Home.vue"),
          meta: { title: "首页" },
        },
        // 系统管理
        {
          path: "/guanlizhanghao",
          name: "系统管理",
          meta: { title: "系统管理" },
          children: [
            {
              path: "/guanlizhanghao",
              name: "管理账号",
              component: () => import("../views/xitong/Guanlizhanghao.vue"),
              meta: { title: "管理账号" },
            },
            {
              path: "/jueseguanli",
              name: "角色管理",
              component: () => import("../views/xitong/Jueseguanli.vue"),
              meta: { title: "角色管理" },
            },
            {
              path: "/quanxian",
              name: "权限管理",
              component: () => import("../views/xitong/Quanxian.vue"),
              meta: { title: "权限管理" },
            },
          ],
        },
        // 广告管理
        {
          path: "/guangaolist",
          name: "广告管理",
          meta: { title: "广告管理" },
          children: [
            {
              path: "/guangaolist",
              name: "广告列表",
              component: () => import("../views/guanggao/Guangaolist.vue"),
              meta: { title: "广告列表" },
            },
          ],
        },
        // 新闻管理
        {
          path: "/xinwenlist",
          name: "新闻管理",
          meta: { title: "新闻管理" },
          children: [
            {
              path: "/xinwenlist",
              name: "新闻列表",
              component: () => import("../views/xinwen/Xinwenlist.vue"),
              meta: { title: "新闻列表" },
            },
          ],
        },
        // 视频管理
        {
          path: "/shipinlist",
          name: "视频管理",
          meta: { title: "视频管理" },
          children: [
            {
              path: "/shipinlist",
              name: "视频列表",
              component: () => import("../views/shipin/Shipinlist.vue"),
              meta: { title: "视频列表" },
            },
          ],
        },
        // 商品管理
        {
          path: "/fenlei",
          name: "商品管理",
          meta: { title: "商品管理" },
          children: [
            {
              path: "/fenlei",
              name: "分类管理",
              component: () => import("../views/shangpin/Fenlei.vue"),
              meta: { title: "分类管理" },
            },
            {
              path: "/shangpinlist",
              name: "商品列表",
              component: () => import("../views/shangpin/Shangpinlist.vue"),
              meta: { title: "商品列表" },
            },
            {
              path: "/dingfan",
              name: "订单管理",
              component: () => import("../views/shangpin/Dingfan.vue"),
              meta: { title: "订单管理" },
            },
          ],
        },
        // 汽修订单
        {
          path: "/dingdanjiesuan",
          name: "汽修订单",
          meta: { title: "汽修订单" },
          children: [
            {
              path: "/dingdanjiesuan",
              name: "订单结算",
              component: () => import("../views/qixiu/Dingdanjiesuan.vue"),
              meta: { title: "订单结算" },
            },
            {
              path: "/xiadan",
              name: "下单",
              component: () => import("../views/qixiu/Xiadan.vue"),
              meta: { title: "下单" },
            },
          ],
        },
        // 用户管理
        {
          path: "/userlist",
          name: "用户管理",
          meta: { title: "用户管理" },
          children: [
            {
              path: "/userlist",
              name: "用户列表",
              component: () => import("../views/user/Userlist.vue"),
              meta: { title: "用户列表" },
            },
            {
              path: "/jifen",
              name: "汽修积分",
              component: () => import("../views/user/Jifen.vue"),
              meta: { title: "汽修积分" },
            },
          ],
        },
      ],
    },
    {
      path: "/login",
      name: "登录",
      component: () => import("../views/Login.vue"),
      meta: { title: "登录" },
    },
    {
      path: "/dialog",
      name: "对话框",
      component: () => import("../views/Dialog.vue"),
      meta: { title: "对话框" },
    },
    {
      path: "/dialog2",
      name: "对话框2",
      component: () => import("../views/Dialog2.vue"),
      meta: { title: "对话框2" },
    },
  ],
});

export default router;
